<div id="network-supply-algorithm-bar2" style="height: 100%">

</div>

<script type="text/javascript">
    $(function () {
        loadbar1();
        $("select#prjId").change(function(){
            loadbar1();
        });
    });
    function loadbar1() {
        var center=$("#prjId").val();
        $.ajax({
            url: "#springUrl('/network/supply/algorithm/bar2')",
            data: {"center": center},
            type: "POST",
            success: function (text) {
                var d = JSON.parse(text);
                if (d.success && d.data) {
                    var myChart = echarts.init(document.getElementById('network-supply-algorithm-bar2'), 'macarons');
                    var planePath = 'path://M1705.06,1318.313v-89.254l-319.9-221.799l0.073-208.063c0.521-84.662-26.629-121.796-63.961-121.491c-37.332-0.305-64.482,36.829-63.961,121.491l0.073,208.063l-319.9,221.799v89.254l330.343-157.288l12.238,241.308l-134.449,92.931l0.531,42.034l175.125-42.917l175.125,42.917l0.531-42.034l-134.449-92.931l12.238-241.308L1705.06,1318.313z';
                    var color = ['#a6c84c', '#ffa022', '#46bee9', '#D1E9B1', '#7DFF21'];
                    var series = [];
                    var legend = [];
                    d.data.forEach(function (item, i) {
                        legend.push(item.name);
                        series.push({
                                name: item.name,
                                type: 'lines',
                                zlevel: 1,
                                effect: {
                                    show: false,
                                    period: 6,
                                    trailLength: 0.7,
                                    color: '#fff',
                                    symbolSize: 3
                                },
                                lineStyle: {
                                    normal: {
                                        color: color[i],
                                        width: 0,
                                        curveness: 0.2
                                    }
                                },
                                data: item.res
                            },
                            {
                                name: item.name,
                                type: 'lines',
                                zlevel: 2,
                                symbol: ['none', 'arrow'],
                                symbolSize: 2,
                                effect: {
                                    show: false,
                                    period: 10,
                                    trailLength: 0,
                                    symbolSize: 1
                                },
                                label: {
                                    normal: {
                                       // show: true,
                                        //   position: 'right',
                                        formatter: '{a}',
                                        color:'#fff'
                                    }
                                },
                                lineStyle: {
                                    normal: {
                                        color: color[i],
                                        width: 1,
                                        opacity: 0.6,
                                        curveness: 0.2
                                    }
                                },
                                data: item.res
                            });
                    });


                    option = {
                        backgroundColor: '#ffffff',
                        title: {
                            text: '配送中心分配情况',
                            left: 'center',
                            textStyle: {
                                color: '#fff',
                                fontFamily: '微软雅黑1'
                            }
                            , show: false
                        },
                        toolbox: {
                            left: 'left',
                            feature: {
                                restore: {},
                                saveAsImage: {}
                            }
                        },
                        tooltip: {
                            trigger: 'item'
                        },
//                        legend: {
//                            orient: 'vertical',
//                            top: 'bottom',
//                            left: 'right',
//                            data: legend,
//                            textStyle: {
//                                color: '#fff'
//                            }
//                        },
                        geo: {
                            map: 'china',
                            label: {
                                emphasis: {
                                    show: false
                                }
                            },
                            roam: true,
                            itemStyle: {
                                normal: {
                                    areaColor: '#323c48',
                                    borderColor: '#404a59'
                                },
                                emphasis: {
                                    areaColor: '#2a333d'
                                }
                            }
                        },
                        series: series
                    };
                    myChart.setOption(option);
                }
            },
            error:function (text) {
                var div1="<div type='text' style='padding-top:15%' class=' text-center '>"+"查询数据异常"+"</div>";
                $("#network-supply-algorithm-bar2").empty();
                $("#network-supply-algorithm-bar2").prepend(div1);
            }
        });
    }

</script>